package com.le.tester.webpage.masterCode;

/**
 * 描述：
 */
public class TryCatchFinallyDemo {
    public static void main(String[] args) {
        try {
            System.out.println("try is run");
            if (true) {
                //先打印，再使用抛出异常
                System.out.println("try exception info");
                throw new RuntimeException("try exception");
            }
        } catch (Exception e) {
            //catch把try中抛出的异常吃掉了
            System.out.println("catch is run");
            if (true) {
                throw new RuntimeException("catch exception");
            }
        } finally {
            //finally执行完之后，才会抛出catch中的异常
            System.out.println("finally is run");
        }
    }
}
